package cn.com.customer.manager.adapter;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.TextView;

import java.util.List;

import cn.com.customer.manager.R;


/**
 * ============================================
 * 文件名：TakePhotoAdapter.java
 * ============================================
 */
public class DialogWaysAdapter extends BaseAdapter {
    private Context mContext;
    private List<String> mList;

    public DialogWaysAdapter(Context context, List<String> list) {
        this.mContext = context;
        this.mList = list;
    }

    @Override
    public int getCount() {
        return mList == null ? 0 : mList.size();
    }

    @Override
    public Object getItem(int i) {
        return mList.get(i);
    }

    @Override
    public long getItemId(int i) {
        return i;
    }

    @Override
    public View getView(int i, View view, ViewGroup viewGroup) {
        Holder holder;
        if (view == null) {
            view = LayoutInflater.from(mContext).inflate(R.layout.item_simple_text_1, viewGroup, false);
            holder = new Holder();
            holder.text = view.findViewById(R.id.item_text);
            view.setTag(holder);
        } else {
            holder = (Holder) view.getTag();
        }

        holder.text.setText(mList.get(i));
        return view;
    }

    class Holder {
        TextView text;
    }
}
